package com.hk.employeemanagementsystem.web.controller;

import com.hk.employeemanagementsystem.util.web.WebCode;
import com.show.api.ShowApiRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author by 何坤
 * @Classname ShowApiController
 * @Description TODO
 * @Date 2020/1/6 15:51
 */
@RestController
@RequestMapping("/showapi")
public class ShowApiController {
    /**
     * 万维易源的app_id
     */
    private static final String APP_ID = "83193";

    /**
     * 万维易源的app_id的密钥
     */
    private static final String APP_SECRET_KEY = "d53a4d1391484629a1aab58c3ac356c8";

    /**
     * 身份证归属地查询接口的URL
     */
    private static final String ID_CARD_PLACE_OF_OWNERSHIP_API_URL = "http://route.showapi.com/25-3";

    private Logger logger = LoggerFactory.getLogger(ShowApiController.class);

    /**
     * 身份证归属地查询接口
     * @param idCard
     * @return java.util.Map<java.lang.String,java.lang.Object>
     * @date 2020/1/6 15:55
     * @author 何坤
     */
    @GetMapping("/placeOfOwnershipByIdCard")
    public String getNativePlaceByIdCard(@RequestParam("idCard") String idCard){
        String place = new ShowApiRequest(ID_CARD_PLACE_OF_OWNERSHIP_API_URL, APP_ID, APP_SECRET_KEY)
                .addTextPara("id", idCard)
                .post();
        return place;
    }
}
